/*
 * Date :  2021-02-28
 * Author ：w
 * Version ：1.6.2
 */

import request from "@/utils/request";

// 设备列表
export function getDeviceList(params) {
  return request({
    url: "/api/device/deviceTerminalScreen/page",
    method: "get",
    params
  });
}

// 创建设备
export function createDevice(data) {
  return request({
    url: "/api/device/deviceTerminalScreen",
    method: "post",
    data
  });
}

// 设备详情
export function getDevice() {
  return request({
    url: `/api/device/deviceTerminalScreen/${data.id}`,
    method: "get"
  });
}

// 修改设备
export function updateDevice(data) {
  return request({
    url: `/api/device/deviceTerminalScreen/${data.id}`,
    method: "put",
    data
  });
}

// 删除设备
export function deleteDevice(id) {
  return request({
    url: `/api/device/deviceTerminalScreen/${id}`,
    method: "delete"
  });
}

// 根据终端屏幕ID查询所有的传感器
export function getTerminalId() {
  return request({
    url: `/api/device/deviceTerminalScreen/relation/sensor`,
    method: "get"
  });
}

// 终端屏幕和传感器建立关系
export function bindingTerminal(id,params) {
  return request({
    url: `/api/device/deviceTerminalScreen/establish/sensor/${id}`,
    method: "post",
    params
  });
}

// 指令下达
export function getInstructions(params) {
  return request({
    url: "/api/device/instructions/release",
    method: "get",
    params
  });
}

// 获取绑定传感器
export function getTerminalScreenRelation(params) {
  return request({
    url: "/api/device/deviceTerminalScreen/relation/sensor",
    method: "get",
    params
  });
}

// 获取传感器列表
export function getDeviceSensorList() {
  return request({
    url: "/api/device/deviceSensor/all",
    method: "get"
  });
}
